package cn.yuanqiao.archive.appManager.mapper;

import cn.yuanqiao.archive.appManager.domain.TenantMdataList;
import cn.yuanqiao.archive.appManager.domain.TenantRelevance;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 元数据明细Mapper接口
 * 
 * @author yuanqiao
 * @date 2023-06-09
 */
public interface TenantCateMdataListMapper
{
    /**
     * 查询元数据明细
     * 
     * @param id 元数据明细主键
     * @return 元数据明细
     */
    public TenantMdataList selectTenantMdataListById(@Param("id") Long id, @Param("tableName") String tableName);

    /**
     * 查询元数据明细列表
     * 
     * @param tenantMdataList 元数据明细
     * @return 元数据明细集合
     */
    public List<TenantMdataList> selectTenantMdataListList(TenantMdataList tenantMdataList);

    /**
     * 新增元数据明细
     * 
     * @param tenantMdataList 元数据明细
     * @return 结果
     */
    public int insertTenantMdataList(TenantMdataList tenantMdataList);

    /**
     * 修改元数据明细
     * 
     * @param tenantMdataList 元数据明细
     * @return 结果
     */
    public int updateTenantMdataList(@Param("tml") TenantMdataList tenantMdataList, @Param("ids") String ids);

    /**
     * 删除元数据明细
     * 
     * @param id 元数据明细主键
     * @return 结果
     */
    public int deleteTenantMdataListById(@Param("id") Long id, @Param("tableName") String tableName);

    /**
     * 删除元数据明细
     *
     * @param id 元数据明细主键
     * @return 结果
     */
    public int deleteTenantMdataListByGroupId(@Param("id") Long id, @Param("tableName") String tableName);

    /**
     * 批量删除元数据明细
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteTenantMdataListByIds(@Param("ids")Long[] ids, @Param("tableName") String tableName);

    String copyIsRepeat(@Param("ids") String ids, @Param("groupId") Long groupId, @Param("type") Integer type, @Param("tableName") String tableName);

    List<TenantMdataList> getDataListsByIds(@Param("ids")String ids, @Param("tableName") String tableName);

    TenantMdataList isExist(@Param("fieldName")String fieldName, @Param("groupId") Long groupId, @Param("type") Integer type, @Param("tableName") String tableName);

    int careateMdataListTable(@Param("tableName") String tableName);

    void initMdataList(@Param("tableName")String tableName, @Param("categoryIds") String categoryIds);

    List<TenantMdataList> getMdataListModel(Long groupId);

    List<TenantMdataList> getjiancunchuziduan(@Param("categoryId") String categoryId, @Param("mdatalistTable") String mdatalistTable, @Param("categoryTable") String categoryTable);
    List<TenantMdataList> getjianziduanselect(@Param("categoryId") String categoryId, @Param("mdatalistTable") String mdatalistTable, @Param("categoryTable") String categoryTable);
    List<TenantMdataList> getselect(@Param("categoryId") String categoryId, @Param("mdatalistTable") String mdatalistTable,
                                    @Param("categoryTable") String categoryTable, @Param("fieldTable") String fieldTable, @Param("type") Integer type);
    List<TenantMdataList> getcodecolumnname(@Param("categoryId") String categoryId, @Param("mdatalistTable") String mdatalistTable, @Param("categoryTable") String categoryTable, @Param("type") Integer type);
    List<TenantMdataList> getpaixuselect(@Param("categoryId") String categoryId, @Param("mdatalistTable") String mdatalistTable, @Param("categoryTable") String categoryTable, @Param("type") Integer type);
    String getorderright(@Param("id") Long id, @Param("tableName") String tableName);
    List<TenantMdataList> getorderleft(@Param("categoryId")String categoryId, @Param("type") Integer type,
                                       @Param("fieldName") String fieldName, @Param("mdatalistTable")String mdatalistTable,
                                       @Param("categoryTable") String categoryTable);

    List<Map<String, String>> getshowfieldbytype(@Param("type") Integer type, @Param("mdatatype") int mdatatype, @Param("categorytableName") String categorytableName, @Param("mdataListTableName") String mdataListTableName, @Param("insql")String insql, @Param("ordersql")String ordersql);

    String getshowfieldbyapply(@Param("categoryId") Long categoryId, @Param("menuId")  Long menuId, @Param("field") String field, @Param("applyTableName") String applyTableName);

    String getexportfieldbyapply(@Param("categoryId") Long categoryId, @Param("menuId")  Long menuId, @Param("field") String field, @Param("applyTableName") String applyTableName);

    String getaddfieldbyapply(@Param("categoryId") Long categoryId, @Param("menuId")  Long menuId, @Param("field") String field, @Param("applyTableName") String applyTableName);

    String getupdatefieldbyapply(@Param("categoryId") Long categoryId, @Param("menuId")  Long menuId, @Param("field") String field, @Param("applyTableName") String applyTableName);

    String getqueryfieldbyapply(@Param("categoryId")Long categoryId, @Param("menuId")Long menuId, @Param("field") String field, @Param("applyTableName") String applyTableName);


    List<Map<String, String>> getshowfieldbyapply2map(@Param("categoryId") Long categoryId, @Param("categorytableName") String categorytableName, @Param("mdataListTableName") String mdataListTableName, @Param("applyString") String applyString, @Param("mdatatype") Integer mdatatype, @Param("orderby") String orderby);

    List<Map<String, String>> getqueryfieldbyapply2map(@Param("categoryId")Long categoryId, @Param("categorytableName") String categorytableName, @Param("mdataListTableName") String mdataListTableName, @Param("applyString")String applyString, @Param("type") Integer type, @Param("orderby") String orderby);

    List<Map<String, String>> getexportfieldbyapply2map(@Param("categoryId")Long categoryId, @Param("categorytableName") String categorytableName, @Param("mdataListTableName") String mdataListTableName, @Param("applyString")String applyString, @Param("type") Integer type, @Param("orderby") String orderby);

    List<Map<String, String>> getaddfieldbyapply2map(@Param("categoryId")Long categoryId, @Param("categorytableName") String categorytableName, @Param("mdataListTableName") String mdataListTableName, @Param("applyString")String applyString, @Param("type") Integer type, @Param("orderby") String orderby);

    List<Map<String, String>> getupdatefieldbyapply2map(@Param("categoryId")Long categoryId, @Param("categorytableName") String categorytableName, @Param("mdataListTableName") String mdataListTableName, @Param("applyString")String applyString, @Param("type") Integer type, @Param("orderby") String orderby);

    List<Map<String, String>> getshowfieldbycategoryId(@Param("categoryId") Long categoryId, @Param("mdatatype") Integer mdatatype, @Param("categorytableName") String categorytableName, @Param("mdataListTableName") String mdataListTableName, @Param("orderby") String orderby);

    List<Map<String, String>> getqueryfieldbycategoryId(@Param("categoryId")Long categoryId, @Param("type") Integer type, @Param("categorytableName") String categorytableName, @Param("mdataListTableName") String mdataListTableName, @Param("orderby") String orderby);

    List<Map<String, String>> getexportfieldbycategoryId(@Param("categoryId")Long categoryId, @Param("type") Integer type, @Param("categorytableName") String categorytableName, @Param("mdataListTableName") String mdataListTableName, @Param("orderby") String orderby);

    List<Map<String, String>> getaddfieldbycategoryId(@Param("categoryId")Long categoryId, @Param("type") Integer type, @Param("categorytableName") String categorytableName, @Param("mdataListTableName") String mdataListTableName, @Param("orderby") String orderby);

    List<Map<String, String>> getupdatefieldbycategoryId(@Param("categoryId")Long categoryId, @Param("type") Integer type, @Param("categorytableName") String categorytableName, @Param("mdataListTableName") String mdataListTableName, @Param("orderby") String orderby);


    String getorder(@Param("categoryId")Long categoryId, @Param("menuId") Long menuId, @Param("field")String field, @Param("applyTableName") String applyTableName);

    List<TenantMdataList> selectTenantMdataListListByMdataList(TenantMdataList select);

    List<TenantMdataList> getSchemelist(TenantMdataList yqdaMdataList);

    String getMddata(@Param("groupId") String groupId, @Param("categoryId") Long categoryId, @Param("tableName") String tableName, @Param("type") int type);

    List<TenantRelevance> getrelevancelist(TenantRelevance relevance);

    void createReleTable(@Param("tableName") String tableName);

    List<Map<String, Object>> getrelevancefield(@Param("field")String field, @Param("nowlevel") Integer nowlevel, @Param("relelevel") Integer relelevel, @Param("fieldtype") Integer fieldtype, @Param("groupId") Long groupId, @Param("mdatalisttableName") String mdatalisttableName, @Param("reletableName") String reletableName, @Param("noequals")String noequals);

    int addrelevance(TenantRelevance relevance);

    TenantRelevance getreledetail(@Param("tableName")String tableName, @Param("id") Long id);

    int editrele(TenantRelevance relevance);

    int delterele(@Param("tableName")String tableName, @Param("ids")List ids);

    int gethadcount(TenantRelevance relevance);

    List<TenantMdataList> selectNewTenantMdataListList(TenantMdataList yqdaMdataList);

    List<Map<String, Object>> getrelelist(@Param("groupid")Long groupid, @Param("level") Integer level, @Param("reletableName") String reletableName);

    Map<String, String> getfieldvaluerele(@Param("id")Long id, @Param("tableName") String tableName, @Param("list") List<String> list);

    List<TenantRelevance> getmodelrele(@Param("groupId")Long groupId);

    String getSingle(@Param("sql") String sql);

    List<Map<String, String>> getListResult1(@Param("sql") String sql);

    void excu(@Param("sql") String sql);
}
